<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <!-- CSRF Token -->
  <meta name="csrf-token" content="{{ csrf_token() }}">

  <title>@yield('title', 'LaraBBS') - Laravel 进阶教程</title>

  <!-- Styles -->
  <link href="/static/layuiadmin/layui/css/layui.css" rel="stylesheet">
  <link href="/static/larabbs/css/larabbs.css" rel="stylesheet">
  <link href="/static/fontawesome/css/all.min.css" rel="stylesheet">
  @yield('styles')

</head>

<body>
  <div id="app" class="{{ route_class() }}-page">

    @include('layouts._header')

    <div class="container">


      @yield('content')

    </div>

    @include('layouts._footer')
  </div>

  <!-- Scripts -->
<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
  //注意：导航 依赖 element 模块，否则无法进行功能性操作
  layui.use(['layer', 'element'], function(){
    var element = layui.element;
    var $ = layui.jquery;
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    //错误提示
    @if(count($errors)>0)
        @foreach($errors->all() as $error)
            layer.msg("{{$error}}",{icon:2});
            @break
        @endforeach
    @endif

    //一次性正确信息提示
    @foreach (['success', 'info'] as $msg)
      @if(session($msg))
        layer.msg("{{session($msg)}}",{icon:1});
      @endif
    @endforeach

    //一次性错误信息提示
    @foreach (['danger', 'warning'] as $msg)
      @if(session($msg))
        layer.msg("{{session($msg)}}",{icon:2});
      @endif
    @endforeach
  });
</script>
@yield('js')

</body>

</html>
